import http from '@/base/http';

/**
 * 公共服务
 */
enum COMMON_API {
  CITY_TREE_LIST = '/city/tree', // 地区选择树状列表
  CITY_TREE_LIST_USER_COUNT = '/city/treeUserCount', // 地区选择树状列表(带用户数)
  CITY_LOCATION = '/api/location/to-city', // 根据经纬度获取地址信息
  CITY_TREE_LIST_D_COUNT = '/city/treeDemandCount', // 地区选择树状列表_带发帖数
}

/**
 * 地区选择树状列表_带发帖数
 */
export function fetchDCityTreeList(data: unknown): Promise<any> {
  return http.get(COMMON_API.CITY_TREE_LIST_D_COUNT, data);
}

/**
 * 地区选择树状列表
 */
export function fetchCityTreeList(data: unknown): Promise<any> {
  return http.get(COMMON_API.CITY_TREE_LIST, data);
}

/**
 * 地区选择树状列表(带用户数)
 */
export function fetchUserCityTreeList(data: unknown): Promise<any> {
  return http.get(COMMON_API.CITY_TREE_LIST_USER_COUNT, data);
}

/**
 * 根据经纬度获取地址信息
 */
export function fetchAddressByLocation(data: unknown): Promise<any> {
  return http.get(COMMON_API.CITY_LOCATION, data);
}
